package com.hoko.blur.api;

import ohos.agp.components.Component;
import ohos.app.Context;
import ohos.media.image.PixelMap;

import com.hoko.blur.anno.Mode;
import com.hoko.blur.anno.Scheme;
import com.hoko.blur.processor.BlurProcessor;
import com.hoko.blur.task.AsyncBlurTask;

import java.util.concurrent.Future;

/**
 * iblur构建
 *
 * @since 2021/08/03
 */
public interface IBlurBuild {
    /**
     * 上下文
     *
     * @param context 上下文
     * @return {@link IBlurBuild}
     */
    IBlurBuild context(Context context);

    /**
     * 模式
     *
     * @param mode 模式
     * @return {@link IBlurBuild}
     */
    IBlurBuild mode(@Mode int mode);

    /**
     * 计划
     *
     * @param scheme 计划
     * @return {@link IBlurBuild}
     */
    IBlurBuild scheme(@Scheme int scheme);

    /**
     * 半径
     *
     * @param radius 半径
     * @return {@link IBlurBuild}
     */
    IBlurBuild radius(int radius);

    /**
     * 样本的因素
     *
     * @param sampleFactor 样本的因素
     * @return {@link IBlurBuild}
     */
    IBlurBuild sampleFactor(float sampleFactor);

    /**
     * 力副本
     *
     * @param isForceCopy 力复制
     * @return {@link IBlurBuild}
     */
    IBlurBuild forceCopy(boolean isForceCopy);

    /**
     * 需要高档
     *
     * @param needUpscale 需要高档
     * @return {@link IBlurBuild}
     */
    IBlurBuild needUpscale(boolean needUpscale);

    /**
     * translatex
     *
     * @param translateX translatex
     * @return {@link IBlurBuild}
     */
    IBlurBuild translateX(int translateX);

    /**
     * translatey
     *
     * @param translateY translatey
     * @return {@link IBlurBuild}
     */
    IBlurBuild translateY(int translateY);

    /**
     * 调度程序
     *
     * @param dispatcher 调度程序
     * @return {@link IBlurBuild}
     */
    IBlurBuild dispatcher(IBlurResultDispatcher dispatcher);

    /**
     * 处理器
     * Get different types of Blur Processors
     *
     * @return {@link BlurProcessor}
     */
    BlurProcessor processor();

    /**
     * 模糊
     *
     * @param bitmap 位图
     * @return {@link PixelMap}
     */
    PixelMap blur(PixelMap bitmap);

    /**
     * 模糊
     *
     * @param view 视图
     * @return {@link PixelMap}
     */
    PixelMap blur(Component view);

    /**
     * 异步模糊
     *
     * @param bitmap 位图
     * @param callback 回调
     * @return {@link Future}
     */
    Future asyncBlur(PixelMap bitmap, AsyncBlurTask.Callback callback);

    /**
     * 异步模糊
     *
     * @param view 视图
     * @param callback 回调
     * @return {@link Future}
     */
    Future asyncBlur(Component view, AsyncBlurTask.Callback callback);

}
